
#include "header_file.h"

void STOP(u16 times)
{
 TIM_Cmd(TIM7,DISABLE); 
	TIM_SetCompare1(TIM1,0);
	TIM_SetCompare2(TIM1,0);	
	TIM_SetCompare3(TIM1,0);
	TIM_SetCompare4(TIM1,0);	
	speed=0;
delay_ms(times);
}
void Run(u8 speed)
{
	TIM_Cmd(TIM7,DISABLE);
	TIM_SetCompare1(TIM1,speed);
	TIM_SetCompare3(TIM1,speed);
	TIM_SetCompare2(TIM1,0);
	TIM_SetCompare4(TIM1,0);	
}
void Back(u8 speed)
{
	TIM_Cmd(TIM7,DISABLE);
	TIM_SetCompare1(TIM1,0);
	TIM_SetCompare3(TIM1,0);
	TIM_SetCompare2(TIM1,speed);
	TIM_SetCompare4(TIM1,speed);	
}
void Left(u8 speed)
{
	 TIM_Cmd(TIM7,DISABLE); 
	TIM_SetCompare2(TIM1,speed);
	TIM_SetCompare3(TIM1,speed);	
	TIM_SetCompare1(TIM1,0);
	TIM_SetCompare4(TIM1,0);
}
void Right(u8 speed)
{
	 TIM_Cmd(TIM7,DISABLE); 
	TIM_SetCompare1(TIM1,speed);
	TIM_SetCompare4(TIM1,speed);
	TIM_SetCompare2(TIM1,0);
	TIM_SetCompare3(TIM1,0);	
}

void Run_adj(u8 l,u8 r)
{
	TIM_Cmd(TIM7,DISABLE);
	TIM_SetCompare1(TIM1, l);
	TIM_SetCompare3(TIM1, r);	
	TIM_SetCompare2(TIM1,0);
	TIM_SetCompare4(TIM1,0);
}
void Back_adj(u8 l,u8 r)
{
	TIM_Cmd(TIM9,DISABLE);
	TIM_SetCompare2(TIM1, l);
	TIM_SetCompare4(TIM1, r);	
}
